<template>
  <div>
    <div class="Toptitle">
      <van-nav-bar title="立即购买" left-arrow @click-left="onClickLeft" />
    </div>
    <div class="box">
      <div class="img">
        <img :src="GoodsObj.img" alt="" />
      </div>
      <div class="content">
        <p class="name">{{ GoodsObj.name }}</p>
        <p class="price">￥{{ GoodsObj.price }}</p>
      </div>
    </div>
    <van-radio-group v-model="radio">
      <van-cell-group>
        <van-cell clickable @click="radio = '1'">
          <template #default>
            <div class="icon">
              <van-icon name="alipay" />
              <div class="font">
                <span class="p1">支付宝支付</span>
                <span class="p2">数亿用户都在用，安全可托付</span>
              </div>
            </div>
          </template>
          <template #right-icon>
            <van-radio name="1" />
          </template>
        </van-cell>
        <van-cell clickable @click="radio = '2'">
          <template #default>
            <div class="icon">
              <van-icon name="wechat" />
              <div class="font">
                <span class="p1">微信支付</span>
                <span class="p2">亿万用户选择，更快更安全</span>
              </div>
            </div>
          </template>
          <template #right-icon>
            <van-radio name="2" />
          </template>
        </van-cell>
      </van-cell-group>
    </van-radio-group>
    <div class="btn">
      <van-button type="danger" round>立即购买</van-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      GoodsObj: {},
      radio: "",
    };
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
  },
  async created() {
    try {
      this.GoodsObj = await this.$route.params.obj;
      //   console.log(res);
    } catch (error) {
      console.log(error);
    }
  },
};
</script>

<style scoped lang="less">
.Toptitle {
  padding-top: 20px;
  background-color: #fff;
  /deep/.van-nav-bar__content {
    height: 50px;
    .van-nav-bar__title {
      font-size: 20px;
    }
    .van-nav-bar__arrow {
      font-size: 24px;
    }
  }
}
.box {
  width: 100%;
  height: 132px;
  display: flex;
  padding: 8px;
  margin-top: 8px;
  background-color: #fff;
  .img {
    width: 112px;
    height: 112px;
    img {
      width: 100%;
    }
  }
  .content {
    height: 112px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .name {
      font-size: 16px;
      color: #333;
    }
    .price {
      color: #d81e06;
      font-size: 18px;
    }
  }
}
.icon {
  //   height: 55px;
  //   line-height: 55px;
  display: flex;
  .font {
    margin-left: 10px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .p1 {
      height: 25px;
      font-size: 16px;
      color: #333;
      display: inline-block;
    }
    .p2 {
      height: 25px;
      font-size: 14px;
      color: #999;
      display: inline-block;
    }
  }
}
/deep/ .van-cell {
  line-height: normal;
  font-size: 50px;
  padding: 8px;
  .van-radio__icon {
    font-size: 24px;
  }
}
.btn {
  margin-top: 200px;
  /deep/.van-button {
    width: 90%;
    height: 50px;
    margin-left: 5%;
    font-size: 18px;
  }
}
</style>
